﻿@model GPS.ENTITYS.CrudModelDDSSH

@{
    ViewBag.Title = "Tạo mới DDSSH";
}

<style type="text/css">
    .btn-file {
        position: relative;
        overflow: hidden;
    }

        .btn-file input[type=file] {
            position: absolute;
            top: 0;
            right: 0;
            min-width: 100%;
            min-height: 100%;
            font-size: 100px;
            text-align: right;
            filter: alpha(opacity=0);
            opacity: 0;
            background: red;
            cursor: inherit;
            display: block;
        }

    input[readonly] {
        background-color: white !important;
        cursor: text !important;
    }
</style>

@using (Html.BeginForm("Create", "GPS_DDSSH", FormMethod.Post, new { enctype = "multipart/form-data" }))
{
    @Html.AntiForgeryToken()


    @Html.ValidationSummary(true)

    <div id="tabs">
        <ul>
            <li><a href="#tabs-1">Hồ sơ DDSSH</a></li>

        </ul>

        <div id="tabs-1">
            @Html.Hidden("IsEdit", 0)

            <fieldset class="fdb-scheduler-border">
                <legend class="fdb-scheduler-border">Thông tin DDSSH</legend>

                <div class="row margin-top-05">
                    <div class="col-md-2 control-label">
                        DSSH_SH_MA
                    </div>
                    <div class="col-md-4">
                        @Html.TextBoxFor(model => model.DSSH_SH_MA, new { @class = "form-control", @id = "DSSH_SH_MA" })
                        @Html.ValidationMessageFor(model => model.DSSH_SH_MA)
                    </div>

                    <div class="col-md-2 control-label">
                        DSSH_TTSH_MA
                    </div>
                    <div class="col-md-2">
                        @Html.TextBoxFor(model => model.DSSH_TTSH_MA, new { @class = "form-control", @id = "DSSH_TTSH_MA" })
                        @Html.ValidationMessageFor(model => model.DSSH_TTSH_MA)
                        <span id="rDataDSSH_TTSH_MA" style="width:300px"></span>
                    </div>
                </div>


                <div class="row margin-top-05">
                    <div class="col-md-2 control-label text-left">
                        Đơn vị đào tạo
                    </div>
                    <div class="col-md-4">
                        @Html.DropDownListFor(model => model.DSSH_CSDT_MA, (SelectList)ViewBag.DSSH_CSDT_MAs, string.Empty, new { @class = "form-control", @style = "width:300px", @id = "DSSH_CSDT_MA" })
                        @Html.ValidationMessageFor(model => model.DSSH_CSDT_MA)
                    </div>

                    <div class="col-md-2 control-label text-left">
                        Đơn vị GTVT
                    </div>
                    <div class="col-md-4">
                        @Html.DropDownListFor(model => model.DSSH_DVGTVT_MA, (SelectList)ViewBag.DSSH_DVGTVT_MAs, string.Empty, new { @class = "form-control", @style = "width:300px", @id = "DSSH_DVGTVT_MA" })
                        @Html.ValidationMessageFor(model => model.DSSH_DVGTVT_MA)
                    </div>
                </div>

                <div class="row margin-top-05">
                    <div class="col-md-2 control-label">
                        Số báo danh
                    </div>
                    <div class="col-md-4">
                        @Html.TextBoxFor(model => model.DSSH_SBD, new { @class = "form-control" })
                        @Html.ValidationMessageFor(model => model.DSSH_SBD)
                    </div>

                    <div class="col-md-2 control-label">
                        Mã học viên
                    </div>
                    <div class="col-md-2">
                        @Html.TextBoxFor(model => model.DSSH_HV_MA, new { @class = "form-control", @id = "DSSH_HV_MA" })
                        @Html.ValidationMessageFor(model => model.DSSH_HV_MA)
                        <span id="rDataDSSH_HV_MA" style="width:300px"></span>
                    </div>
                </div>

                <div class="row margin-top-05">
                    <div class="col-md-2 control-label">
                        Số hồ sơ
                    </div>
                    <div class="col-md-4">
                        @*@Html.TextBoxFor(model => model.DSSH_SOHOSO, new { @class = "form-control", @id = "DSSH_SOHOSO" })
                            <span id="rDataDSSH_SOHOSO" style="width:300px"></span>*@
                        @Html.DropDownListFor(model => model.DSSH_SOHOSO, (SelectList)ViewBag.DSSH_SOHOSOs, string.Empty, new { @class = "form-control", @style = "width:300px", @id = "DSSH_SOHOSO" })
                        @Html.ValidationMessageFor(model => model.DSSH_SOHOSO)
                    </div>

                    <div class="col-md-2 control-label">
                        Loại sát hạch
                    </div>
                    <div class="col-md-2">
                        @Html.DropDownListFor(model => model.DSSH_LOAISH, new List<SelectListItem>
                                {
                                                    new SelectListItem() {Text = "Loại 1", Value="1"},
                                                    new SelectListItem() {Text = "Loại 2", Value="2"}

                                }, new { @class = "form-control", @style = "width:150px" })
                    </div>
                </div>


                <div class="row margin-top-05">

                    <div class="col-md-2 control-label">
                        Ngày sát hạch
                    </div>
                    <div class="col-md-2">
                        @Html.TextBoxFor(model => model.DSSH_NGAYSH, "{0:dd/MM/yyyy}", new { @class = "form-control", @style = "width:120px" })

                    </div>
                    <div class="col-md-2 control-label">
                        Điểm sát hạch
                    </div>
                    <div class="col-md-4">
                        @Html.TextBoxFor(model => model.DSSH_DIEMSH, new { @class = "form-control" })

                    </div>
                </div>

                <div class="row margin-top-05">

                    <div class="col-md-2 control-label">
                        Sát hạch Min
                    </div>
                    <div class="col-md-2">
                        @Html.TextBoxFor(model => model.DSSH_SHMIN, new { @class = "form-control" })

                    </div>
                    <div class="col-md-2 control-label">
                        Sát hạch Max
                    </div>
                    <div class="col-md-4">
                        @Html.TextBoxFor(model => model.DSSH_SHMAX, new { @class = "form-control" })

                    </div>

                </div>

                <div class="row margin-top-05">

                    <div class="col-md-2 control-label">
                        DSSH_SHV
                    </div>
                    <div class="col-md-2">
                        @Html.TextBoxFor(model => model.DSSH_SHV, new { @class = "form-control" })

                    </div>
                    <div class="col-md-2 control-label">
                        Nhận xét
                    </div>
                    <div class="col-md-4">
                        @Html.TextBoxFor(model => model.DSSH_SHVNX, new { @class = "form-control" })

                    </div>

                </div>

                <div class="row margin-top-05">
                    <div class="col-md-2 control-label">
                        Mô tả
                    </div>
                    <div class="col-md-4">
                        @Html.TextAreaFor(model => model.DSSH_MOTA, new { @class = "form-control" })

                    </div>

                </div>

            </fieldset>
            <br />


        </div>


    </div>



    <br />

    <div class="row">
        <div class="col-md-12">
            @*<input type="submit" value="Cập nhật" class="btn btn-info btn-sm" />*@
            <button type="submit" class="btn btn-danger btn-sm">
                <span class="glyphicon glyphicon-floppy-disk"></span> Cập nhật
            </button>
            &nbsp;&nbsp;
            @Html.ActionLink("Quay lại", "Index", null, new { @class = "btn btn-primary btn-sm" })
        </div>

    </div>
}

<script src="~/Scripts/jquery.validate.min.js"></script>
<script src="~/Scripts/jquery.validate.unobtrusive.min.js"></script>

<script src="~/Scripts/datepicker.js"></script>
<script src="~/Scripts/jquery-ui-1.11.4.js"></script>
<script src="~/Scripts/jquery.maskedinput.js"></script>
<script src="~/Scripts/jquery.maskMoney.js"></script>
<script src="~/Scripts/jquery.number.js"></script>
<script src="~/Scripts/jquery.masknumber.js"></script>
<script src="~/Scripts/moment.js"></script>

<script type="text/javascript">

    // Voi jQuery 1.9 > thi chi validate gia tri trong active tab
    // Muon validate nhung gia tri trong cac tab khac nua thi dung jquery.validate 1.8.1 or 1.7


    // mask edit cho truong ngay thang (su dung jquery.maskedinput)


    function ToJavaScriptDate(value) {
        if (value != null) {
            var pattern = /Date\(([^)]+)\)/;
            var results = pattern.exec(value);
            var dt = new Date(parseFloat(results[1]));
            return dt.getDate() + "/" + (dt.getMonth() + 1) + "/" + dt.getFullYear();
        }
        return null;
    }
</script>

<script type='text/javascript'>
    $(document).on('change', '.btn-file :file', function () {
        var input = $(this),
            numFiles = input.get(0).files ? input.get(0).files.length : 1,
            label = input.val().replace(/\\/g, '/').replace(/.*\//, '');
        input.trigger('fileselect', [numFiles, label]);
    });

    function preview_image(event) {
        var reader = new FileReader();
        reader.onload = function () {
            var output = document.getElementById('output_image');
            output.src = reader.result;
        }
        reader.readAsDataURL(event.target.files[0]);
    }
</script>

<script type="text/javascript">
    $("#DSSH_NGAYSH").datepicker({
        changeMonth: true,
        changeYear: true,

        dateFormat: 'dd/mm/yy'
    });


    $("#DSSH_NGAYSH").mask("99/99/9999", { placeholder: "dd/mm/yyyy" });

    // cho phep nhap so thap phan (su dung jquery.number)
    //$("#GV_THAMNIENLX").number(true, 2, '.', '');

</script>

@Styles.Render("~/Content/themes/base/css")

<script type="text/javascript">
    $(document).ready(function () {
        $("#DSSH_TTSH_MA").autocomplete({
            source: function (request, response) {
                $.ajax({
                    url: "/GPS_GiaoVien/AutoCompleteDSSH_TTSH_MA",
                    type: "POST",
                    dataType: "json",
                    data: { term: request.term },
                    success: function (data) {
                        response($.map(data, function (item) {
                            return { label: item.SH_TENKYSH, value: item.SH_MA };
                        }))


                    }
                })
            },
            messages: {
                noResults: "", results: ""
            }
        });

        //mã học viên
        $("#DSSH_HV_MA").autocomplete({
            source: function (request, response) {
                $.ajax({
                    url: "/GPS_GiaoVien/AutoCompleteDSSH_HV_MA",
                    type: "POST",
                    dataType: "json",
                    data: { term: request.term },
                    success: function (data) {
                        response($.map(data, function (item) {
                            return { label: item.HV_HODEM, value: item.HV_MA };
                        }))


                    }
                })
            },
            messages: {
                noResults: "", results: ""
            }
        });

        //hồ sơ:

        //$("#DSSH_SOHOSO").autocomplete({
        //    source: function (request, response) {
        //        $.ajax({
        //            url: "/GPS_GiaoVien/AutoCompleteDSSH_SOHOSO",
        //            type: "POST",
        //            dataType: "json",
        //            data: { term: request.term },
        //            success: function (data) {
        //                response($.map(data, function (item) {
        //                    return { label: item.SH_TENKYSH, value: item.SH_MA };
        //                }))


        //            }
        //        })
        //    },
        //    messages: {
        //        noResults: "", results: ""
        //    }
        //});



    })
</script>